package org.abac4j.context;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

import java.util.Iterator;

public class AttributeRepository {
	public Map<String, Object> attributeMap = new HashMap<String, Object>();

	public Map<String, Object> getAttributeMap() {
		return attributeMap;
	}

	public void setAttributeMap(Map<String, Object> attributeMap) {
		this.attributeMap = attributeMap;
	}

	public AttributeRepository() {
		attributeMap.put("currentTime", new Date(System.currentTimeMillis()));
	}
	
	public void addAttributeMap(Map<String, Object> newMap) {
		for (Iterator<Entry<String, Object>> it = newMap.entrySet().iterator(); it.hasNext(); ) {
			Entry<String, Object> entry = it.next();
			attributeMap.put(entry.getKey(), entry.getValue());
		}
	}
}